#include <stdio.h>
#include <signal.h>

sig_handler(sig)
int sig;
{ 
    switch (sig)
    {
	case SIGFPE:
	    printf("SIGFPE  received...\n");
	    break;
	case SIGSEGV:
	    printf("SIGSEGV received...\n");
	    break;
	default:
	    printf("should not be here\n");
	    break;
    }
}

main() 
{
    signal(SIGFPE,sig_handler); 
    signal(SIGSEGV,sig_handler);
    while (1)
	;
}
